package com.xdf.xzymanagementsystem.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: xzy-management-system
 * @description: 仓库
 * @author: 张柯
 * @create: 2021-04-28 12:58
 **/
public enum StorageEnum {
    MATERIAL, PRODUCT, SEMI_FINISHED;

    public static StorageEnum match(String name) {
        for (StorageEnum item : values()) {
            if (item.toString().equals(name)) {
                return item;
            }
        }
        return null;
    }

    public static List<StorageEnum> matchArr(String name) {
        if (name == null || name.length() <= 0) return null;
        String[] arr = name.split(",");
        List<StorageEnum> list = new ArrayList<>();
        for (String s : arr) {
            StorageEnum e = match(s);
            if (s != null)
                list.add(e);
        }
        return list;
    }
}
